from pynput.keyboard import Key, Controller
import time

# 准备演奏
# 控制键盘
keyboard = Controller()
# 切换到jQuery键盘钢琴网页
keyboard.press(Key.alt)
time.sleep(1)
keyboard.press(Key.tab)
keyboard.release(Key.tab)
keyboard.release(Key.alt)
time.sleep(2)
t = 0.6
# momqp lnlpo lrqomop-po rrqqp psppo rrqqppopqrqq ttsspprqpo mqoo sqpp--- momqp lnlpo momqppopsq ttttspsppo mrqomopo
for n in "-momqp lnlpo mrqo.m-opo =momqp lnlpo momqppopsq":
    if n == '-':
        t = 0.8
    elif n == '=':
        t = 0.55
    elif n == '.':
        t = 1.55
    elif n != " ":
        keyboard.press(n.lower())
        time.sleep(t)
        keyboard.release(n.lower())
    else:
        time.sleep(1.2)
